<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>欢迎首页</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <script>
        top.layui.each(top.layui.$('link'), function (index, item) {
            if (item.href.includes("layui.css") || item.href.includes("admin.css") || item.href.includes("custom.css")) {
                var oLi = document.createElement("link");
                oLi.rel = "stylesheet", oLi.href = decodeURIComponent(item.href), oLi.media = "all";
                var ul = document.getElementsByTagName("head")[0].appendChild(oLi)
            }
        })
    </script>
    <style>
    </style>
</head>

<body>

    <div class="layui-card tab_form_card layui-form forceForm-item ">
        <div class="layui-card-header">
            <a href="https://www.layui.com/doc/modules/laytpl.html">点击这里进入官网</a>
        </div>
        <div class="layui-card-body" pad15>
            <form class="layui-form" lay-filter="form-body">
                <div class="layui-form-item myrow_item">
                    <div class="layui-row">

                        {{# layui.each(d.list, function(index, item){ }}
                        <div class="layui-col-sm6 layui-col-xs12 layui-col-md3">
                            <div class="layui-form-item">
                                <label class="layui-form-label from-lable">
                                    {{ item }}
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" id="" name="Guid" placeholder="请输入客户名称" autocomplete="off"
                                        class="layui-input"></input>
                                </div>
                            </div>
                        </div>
                        {{# }) }}

                    </div>
                </div>
                <div class="layui-form-item myrow_item">
                    <div class="layui-input-block">
                        <button type="button" class="layui-btn" lay-submit lay-filter="setmypass">确认修改</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <div class="layui-collapse">
        <div class="layui-colla-item">
            <h2 class="layui-colla-title">展示源代码</h2>
            <div class="layui-colla-content layui-show">
                <pre class="layui-code" id="code-html"></pre>
                <pre class="layui-code" id="code-js"></pre>
            </div>
        </div>
    </div>

    <script src="../../layuiadmin/layui/layui.js"></script>
    <script id="sourceCode">
        var codeHtml = `{{# layui.each(d.list, function(index, item){ }}
<div class="layui-col-sm6 layui-col-xs12 layui-col-md3">
    <div class="layui-form-item">
        <label class="layui-form-label from-lable">
            {{ item }}
        </label>
        <div class="layui-input-inline">
            <input type="text" id="" name="Guid" placeholder="请输入客户名称" autocomplete="off"
                class="layui-input"></input>
        </div>
    </div>
</div>
{{# }) }}`
        var codeJs = `layui.use(['jquery', 'laytpl'], function () {
    var $ = layui.jquery,
        laytpl = layui.laytpl

    var data = {
        list: ['名称', '姓氏', '学历', '最高学院']
    }
    laytpl($(".layui-row").get(0).innerHTML).render(data, function (html) {
        $(".layui-row").get(0).innerHTML = html
    })
})`
    </script>
    <script>
        layui.config({
            base: '../../layuiadmin/'
        }).extend({
            index: 'lib/index', //主入口模块
        }).use(['jquery', 'element', 'code', 'laytpl'], function () {
            var $ = layui.jquery,
                element = layui.element,
                laytpl = layui.laytpl

            var data = {
                list: ['名称', '姓氏', '学历', '最高学院']
            }
            laytpl($(".layui-row").get(0).innerHTML).render(data, function (html) {
                $(".layui-row").get(0).innerHTML = html
            })

            // 下面是源码的优化方法
            $("#code-html").text(codeHtml)
            $("#code-js").text(codeJs)
            layui.code({
                elem: '#code-html',
                title: 'HTML源码',
                about: false
            }); //引用code方法
            layui.code({
                elem: '#code-js',
                title: 'JavaScript源码',
                about: false
            }); //引用code方法
        })
    </script>
</body>

</html>